<?php
/*
 *
 * Created on 2012-10-11
 *
 * @author xsong
 *
 */

include("../nncms_manager_inc.php");
$action=$_GET["action"];


if($action =='get_bind_product' || $action=='delete_content_bind_product'){
	require_once $nncms_db_path. "nns_products".DIRECTORY_SEPARATOR . "nns_db_products_class.php";
	    $product_inst = new nns_db_products_class();
}
switch ($action){
  	case "get_bind_product":
	    require_once $nncms_db_path. "nns_products".DIRECTORY_SEPARATOR . "nns_db_product_bind_content_class.php";
	    $product_content_inst = new nns_db_product_bind_content_class();
        $bind_product = $product_content_inst->get_service_bind_product($_GET['nns_service_id'],$_GET['nns_category_id']);
	    if(!$bind_product) $bind_product = array();
	    echo json_encode($bind_product);
    break;
    case "delete_content_bind_product":
    	if(isset($_GET["nns_product_content_id"])){
   		   $result = $product_inst->delete_assist_bind_product($_GET["nns_product_content_id"]);
	 		echo json_encode($result);
	  	}
 	break;
 }
?>